// SecureHttpClient.h
#pragma once
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonObject>

class SecureHttpClient : public QObject {
    Q_OBJECT
public:
    explicit SecureHttpClient(QObject *parent = nullptr);

    void get(const QString &url);
    void post(const QString &url, QString token, const QByteArray &data);

signals:
    void responseReady(const QJsonObject &data);
    void requestFailed(int code, const QString &error);

private:
    QNetworkAccessManager *manager;

    void configureSsl(QNetworkRequest &request);
    void handleSslErrors(const QList<QSslError> &errors);

    void handleResponseReady(const QByteArray &data);
};
